package com.school.service;

import com.school.dao.StudentDAO;
import com.school.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StudentService {
    @Autowired
    private StudentDAO dao;

    public StudentService() {
        System.out.println("StudentService创建！");
    }

    @Override
    public String toString() {
        return "StudentService{" +
                "dao=" + dao +
                '}';
    }

    public Student[] selectAll() {
        Student[] students = dao.selectAll();
        return students;
    }

    public int insertOne(Student student) {
        int flag = dao.insertOne(student);
        return flag;
    }

    public int updateOne(Student student) {
        int flag = dao.updateOne(student);
        return flag;
    }

    public int deleteOne(int stuNum) {
        int flag = dao.deleteOne(stuNum);
        return flag;
    }

}
